#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int largestPerimeter(vector<int>& A) {
	if(A.size() < 3){
		return 0;
	}
	//首先排序,如果最大的三个数能够满足要求，那么其就是结果
	sort(A.begin(),A.end());
	int three=A.size()-1;
	int two=three-1;
	int one=two-1;
	for(;three>=2;--three){
		two=three-1;
		one=two-1;
		if(A[one]+A[two] > A[three]){
			cout<<three<<endl;
			return A[one]+A[two]+A[three];
		}
	}
	return 0;
}

int main()
{
	vector<int> a={3,2,3,4};
	cout<<largestPerimeter(a)<<endl;
}
